<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
    <title>实名认证</title>
    <link rel="stylesheet" type="text/css" href="../../css/mui.min.css"/>
    <link rel="stylesheet" type="text/css" href="../../css/own.css"/>
    <script type="text/javascript" src="../../js/mui.min.js" ></script>
	<script type="text/javascript" src="../../js/common.js"></script>
	<script>
		mui.init({
//		    subpages:[{
//		      url:'../commonback.html',
//		      id:'common.html',
//		      styles:{
//		        top:'0px',//mui标题栏默认高度为45px；
//		      }
//		    }]
		  });  
		mui.plusReady(function(){
			document.getElementById("verified").addEventListener("tap",function(){
				openVerified();
			});
			
			//初始化监听头部和底部事件
			tzdr.init.initHearListener();
		});
	       function	openVerified(){
	       	var username=document.getElementById("username").value;
	       	var card=document.getElementById("card").value;
	       	var paramUrl={
				url:"../login/login.html"
			}
	       	if(mui.isnull(username)){
	       		mui.toast("真实姓名不能为空！");
	       		return;
	       	}
	       	if(username.length<2||username.length>4){
	       		mui.toast("真实姓名有误！");
	       		return;
	       	}
	       	if(mui.isnull(card)){
	       		mui.toast("身份证号不能为空！");
	       		return;
	       	}
	       	plus.nativeUI.showWaiting("认证中...");
	       	mui.app_request("/user/security/validatecard",{
	       		"name":username,
	       		"card":card
	       	},function(result){
	       		plus.nativeUI.closeWaiting();
	       		mui.toast("认证成功！");
	       		
	       		mui.app_refresh(plus.webview.currentWebview().backPage);
	       		return;
	       	},function(result){
	       		plus.nativeUI.closeWaiting();
	       		if(result.code==2){
	       			mui.toast("实名认证失败！");
	       			return;
	       		}else if(result.code==3){
	       			mui.toast("身份证号格式有误！");
	       			return;
	       		}else if(result.code==4){
	       			mui.toast("该身份证已被认证过！");
	       			return;
	       		}else if(result.code==5){
	       			mui.toast("实名不能为空！");
	       			return;
	       		}else if(result.code==6){
	       			mui.toast("身份证号码不能为空！");
	       			return;
	       		}else if(result.code==7){
	       			mui.toast("已经实名认证过！");
	       			return;
	       		}else if(result.code==8){
	       			mui.toast("实名失败次数已超过最高次数！");
	       			return;
	       		}else{
	       			mui.toast("系统繁忙，请稍后再试！");
	       			return;
	       		}
	       	},paramUrl)
	       	
	       	
	       };
		
	</script>



</head>
<body>	
	<header class="mui-bar mui-bar-nav own-topbg">
		<a class="mui-action-back mui-icon mui-icon-left-nav mui-pull-left" id="back"><i>返回</i></a>
		<h1 class="mui-title">实名认证</h1>		
		<a href="javascript:void(0)" class="top-tel" id="online">在线客服</a>
	</header>
	<!--<nav class="navlist">
		<a href="javascript:void(0);" id="product">
			<span class="mui-icon mui-icon-list"></span>
			<span class="mui-tab-label">产品</span>
		</a>
		<a class="" href="javascript:void(0);"  id="scheme">
			<span class="mui-icon mui-icon-compose"></span>
			<span class="mui-tab-label">方案</span>
		</a>
		<a  class="navon"  id="account" href="javascript:void(0);">
			<span class="mui-icon mui-icon-contact mui-icon-icon-contact-filled"></span>
			<span class="mui-tab-label" >账户</span>
		</a>
	</nav>-->
	<div class="mui-content ac_tel">
		<form class="mui-input-group">
			<div class="mui-input-row">
				<label>真实姓名</label>

				<input id="username" type="text" class="mui-input-clear mui-input" placeholder="">

				<!--<input type="text" class="mui-input-clear mui-input" placeholder="">-->

			</div>
			<div class="mui-input-row">
				<label>身份证号</label>
				<input id="card" type="text" class="mui-input-clear mui-input" placeholder="">
			</div>
		</form>
		<div class="mui-content-padded">
			<button type="button" id="verified" class="mui-btn mui-btn-block lg-btnlogin">立即认证</button>
		</div>
	</div>
</body>
<script>
	tzdr.online();
</script>
</html>